import pytest

#
#
# def aaaaa(func):
#     def abc(*args, **kw):
#         print("hello,")
#         return func(*args, **kw)
#     return abc()
#
#
# @aaaaa
# def ddef():
#     print("world!")
#
#
# ddef()
#
#
# def log(func):
#     def wrapper(*args, **kw):
#         print('call %s():' % func.__name__)
#         return func(*args, **kw)
#
#     return wrapper    # 去掉这里的括号，会导致TypeError: 'NoneType' object is not callable
#
#
# @log    # 等于 now = aaaaa(new)
# def now():
#     print('2021-3-25')
#
#
# if __name__ == '__main__':
#     now()


test_login_data = [("admin", "111111"),  ("admin", "")]

def login(user, psw):
    '''普通登录函数'''
    print("登录账户：%s"%user)
    print("登录密码：%s"%psw)
    if psw:
        return True
    else:
        return False

@pytest.mark.parametrize("user, psw", test_login_data)
def test_login(user, psw):
    '''登录用例'''
    result = login(user, psw)
    assert result == True, "失败原因：密码为空"


if __name__ == "__main__":
    pytest.main(["-s", "test_01.py"])